const Router = require('koa-router')
const fileValidate = require('@/middlewares/validateMiddlewares/fileValidate')
const fileController = require('@/controller/fileController')
const { verifyToken } = require('@/utils/jwt')

const { verifyAuth } = require('@/middlewares/authMiddlewares/verifyAuth')
const { getDepsInfo } = require('@/controller/userController')
const { cleanFile } = require('@/controller/scheduleTaskController')

const router = new Router()

/**
 * 文件上传协商接口
 */

router.post(
  '/handshark',
  verifyToken(),
  verifyAuth(['source.upload']),
  fileValidate.fileExistValidate,
  fileValidate.fileSharkValidate,
  fileController.fileHandShark
)

/**
 * 文件分片上传接口
 */

router.post(
  '/upload',
  verifyToken(),
  verifyAuth(['source.upload']),
  fileValidate.chunkUploadValidate,
  fileController.chunkUpload
)

/**
 * 测试根据roleId获取permission数组
 */
// router.get('/zeroFile', cleanFile)

module.exports = router
